package com.sright.bcard.common.biz.service;

import com.alibaba.fastjson.JSONObject;
import com.sright.bcard.common.biz.manager.WxappManager;
import com.sright.bcard.common.service.share.dto.common.ContentCheckDTO;
import com.sright.bcard.common.service.share.dto.page.PageDTO;
import com.sright.bcard.common.service.share.dto.page.PageParamRequest;
import com.sright.bcard.common.service.share.dto.common.WxappDTO;
import com.sright.bcard.common.share.service.WxappService;
import com.sright.common.response.SrightResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@Slf4j
public class WxappServiceImpl implements WxappService {

    @Autowired
    private WxappManager wxappManager;

    @Override
    public SrightResponse<PageDTO<WxappDTO>> wxappList(PageParamRequest pageParamRequest) {
        return SrightResponse.defaultSuccess(wxappManager.wxappList(pageParamRequest));
    }

    @Override
    public SrightResponse<Integer> status(WxappDTO wxappDTO) {
        return SrightResponse.defaultSuccess(wxappManager.status(wxappDTO));
    }

    @Override
    public SrightResponse<Integer> deleteStatus(Long id) {
        return SrightResponse.defaultSuccess(wxappManager.deleteStatus(id));
    }

    @Override
    public SrightResponse getEnterpriseWxappInfo(Long enterpriseId) {
        return wxappManager.getEnterpriseWxappInfo(enterpriseId);
    }

    @Override
    public SrightResponse createQrCode(String path) throws Exception {
        return wxappManager.createQrCode(path);
    }

    @Override
    public SrightResponse getInviteCode(Long enterpriseId) throws Exception {
        return wxappManager.getInviteCode(enterpriseId);
    }

    @Override
    public SrightResponse getPreviewCode(Long userId) throws Exception {
        return wxappManager.getPreviewCode(userId);
    }

    @Override
    public void sendVisitorTemplateMessage(Map<String, String> map) throws Exception {
        wxappManager.sendVisitorTemplateMessage(map);
    }

    @Override
    public JSONObject wechatLogin(String code) {
        return wxappManager.wechatLogin(code);
    }

    @Override
    public ContentCheckDTO checkContent(String content) {
        return wxappManager.checkContent(content);
    }

    @Override
    public void sendDataStatisticsTemplateMessage(Map<String, String> map) throws Exception {
        wxappManager.sendDataStatisticsTemplateMessage(map);
    }
}
